package com.richinfo.buddy.oauthserver.security.service;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

import com.richinfo.buddy.oauthserver.model.entity.MyUserEntity;
import com.richinfo.buddy.oauthserver.model.security.SecurityUser;


/**
 * 
* Created by WangXJ
* 2019-04-11 14:22
*/
@Component
public class MyUserDetailsService implements UserDetailsService{
	
	private static final Logger logger = LoggerFactory.getLogger(MyUserDetailsService.class);
	
//	@Resource
//	private UserService userService;

	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		
		logger.info("登录用户名为：" + username);
//		MyUserEntity user = userService.findByUserName(username);
		// User对象的构造函数参数：username和password 用来做认证，authorities 用来做授权
//		User securityUser = new User(user.getUserName(), user.getPassword(), 
//									 AuthorityUtils.commaSeparatedStringToAuthorityList("admin"));
//		return securityUser;
//		SecurityUser suser = new SecurityUser(user);
//		return suser;
		return null;
	}


}






